package tw.com.softleader.spring.service.impl;

import java.util.List;

import tw.com.softleader.spring.dao.SpringDao;
import tw.com.softleader.spring.service.SpringService;

public class SpringServiceImpl implements SpringService{
	
	private String greeting;
	
	private List<String> vendors;
	
	private SpringDao springDao;

	public void setGreeting(String greeting) {
		this.greeting = greeting;
	}
	
	public void setVendors(List<String> vendors) {
		this.vendors = vendors;
	}

	public void setSpringDao(SpringDao springDao) {
		this.springDao = springDao;
	}

	@Override
	public String getHello(String name) {
		String vendorStr = "";
		
		for(String vendor:vendors){
			vendorStr += vendor+";";
		}
		
		return vendorStr+" Say "+greeting +" to "+name;
	}

	@Override
	public List<String> getAllfruits() {
		List<String> fruitList = springDao.findAll();
		
		
		return fruitList;
	}

}
